$(document).ready(function(){	
	$(".product").on("change", function(){
		var id = $(this).val();
		var txt = this.options[this.selectedIndex].text;
		$.getJSON("/droowa/product/getProductInfo.do", {"id":id,"sort":txt}, callback);
	});
	
});
var cpu = ${requestScope.completePCDetailPrice.CPUPRICE};
var mainboard = ${requestScope.completePCDetailPrice.MAINBOARDPRICE};
var cooler = ${requestScope.completePCDetailPrice.COOLERPRICE};
var memory = ${requestScope.completePCDetailPrice.MEMORYPRICE};
var graphic = ${requestScope.completePCDetailPrice.GRAPHICPRICE};
var hdd = ${requestScope.completePCDetailPrice.HDDPRICE};
var ssd = ${requestScope.completePCDetailPrice.SSDPRICE};
var dvd = ${requestScope.completePCDetailPrice.DVDPRICE};
var sound = ${requestScope.completePCDetailPrice.SOUNDPRICE};
var power = ${requestScope.completePCDetailPrice.POWERPRICE};
var kase = ${requestScope.completePCDetailPrice.CASEPRICE};
var os = ${requestScope.completePCDetailPrice.OSPRICE};
var keyboard = 0;
var moniter = 0;
var ram = ${requestScope.completePCDetailPrice.RAMPRICE};
var mouse = 0;
var sum = 0;
function callback(data){
	if(data.category=='CPU'){
		cpu = data.price;
		$("#cpu").html(data.name);
		$("#picture").html("<img height='244px' width='244px' src='/droowa/product-img/"+data.fileName+"'>");
	}else if(data.category=='마우스'){
		mouse = data.price;
		
	}else if(data.category=='파워'){
		power = data.price;
		$("#power").html(data.name);
		$("#picture").html("<img height='244px' width='244px' src='/droowa/product-img/"+data.fileName+"'>");
	}else if(data.category=='키보드'){
		keyboard = data.price;
		
	}else if(data.category=='케이스'){
		kase = data.price;
		$("#case").html(data.name);
		$("#picture").html("<img height='244px' width='244px' src='/droowa/product-img/"+data.fileName+"'>");
	}else if(data.category=='모니터'){
		moniter = data.price;
		
	}else if(data.category=='메인보드'){
		mainboard = data.price;
		$("#mainboard").html(data.name);
		$("#picture").html("<img height='244px' width='244px' src='/droowa/product-img/"+data.fileName+"'>");
	}else if(data.category=='쿨러'){
		cooler = data.price;
		$("#cooler").html(data.name);
		$("#picture").html("<img height='244px' width='244px' src='/droowa/product-img/"+data.fileName+"'>");
	}else if(data.category=='RAM'){
		ram = data.price;
		$("#ram").html(data.name);
		$("#picture").html("<img height='244px' width='244px' src='/droowa/product-img/"+data.fileName+"'>");
	}else if(data.category=='그래픽카드'){
		graphic = data.price;
		$("#graphic").html(data.name);
		$("#picture").html("<img height='244px' width='244px' src='/droowa/product-img/"+data.fileName+"'>");
	}else if(data.category=='HDD'){
		hdd = data.price;
		$("#hdd").html(data.name);
		$("#picture").html("<img height='244px' width='244px' src='/droowa/product-img/"+data.fileName+"'>");
	}else if(data.category=='SSD'){
		ssd = data.price;
		$("#ssd").html(data.name);
		$("#picture").html("<img height='244px' width='244px' src='/droowa/product-img/"+data.fileName+"'>");
	}else if(data.category=='DVD'){
		dvd = data.price;
		$("#dvd").html(data.name);
		$("#picture").html("<img height='244px' width='244px' src='/droowa/product-img/"+data.fileName+"'>");
	}else if(data.category=='사운드카드'){
		sound = data.price;
		$("#sound").html(data.name);
		$("#picture").html("<img height='244px' width='244px' src='/droowa/product-img/"+data.fileName+"'>");
	}else if(data.category=='운영체제'){
		os = data.price;
		$("#os").html(data.name);
		$("#picture").html("<img height='244px' width='244px' src='/droowa/product-img/"+data.fileName+"'>");
	}else if(data.category=='메모리'){
		memory = data.price;
		$("#memory").html(data.name);
		$("#picture").html("<img height='244px' width='244px' src='/droowa/product-img/"+data.fileName+"'>");
	}
	
	sum = cpu+mainboard+cooler+memory+graphic+hdd+ssd+dvd+sound+power+kase+os;
	$("#sum").html(sum);
	$("#completePrice").val(sum);
	$("#completeId").val(data.completeId);
}